package com.example.blog.dao;

import com.example.blog.entity.Comments;

import com.example.blog.entity.PostsInfo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.Map;

/**
 * @ClassName: FoodInfoRespository
 * @Description:

 * @Date 2023/9/9
 * @Version 1.0
 */
@Repository
public interface CommentsRepository extends JpaRepository<Comments,String>, JpaSpecificationExecutor<Comments> {
    @Query(nativeQuery = true,value = "select s.* from comments s where s.postInfoId = ?1",countQuery = "select count(*) from comments s where s.postInfoId = ?1")
    Page<Map> findByPostInfoId(String postId,Pageable pageable);
}
